home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Sapphire Collection / Software Vault (Sapphire Collection) (Digital Impact).ISO / cdr47 / pgloader.zip / WR.ASM < prev   
Assembly Source File  |  1994-10-01  |  15KB  |  326 lines

  1. ;============================================================================;
  2. ; The writer here has been modified to handle monocolor fonts, by dealing    ;
  3. ; with them in binary format as opposed to the color font format, which is   ;
  4. ; one byte per pixel. My font cutter program was originally designed to do   ;
  5. ; scroller fonts, so it deals with them sideways <wierd..> Anyway, I had to  ;
  6. ; design this writer to do the same. It's fairly quick.                      ;
  7. ;============================================================================;
  8.         ;-------------------------------;
  9.         ; Throw me some data points.    ;
  10. LXMOVE  equ     7                       ;
  11. LYMOVE  equ     14                      ;
  12. LXSTART equ     -1                      ;
  13. LYSTART equ     50                      ;
  14. wr_font_seg     dw      0               ;
  15. wr_font_off     dw      0               ;
  16. wr_xsize        dw      0               ;
  17. wr_ysize        dw      0               ;
  18. wr_savesi       dw      0               ;
  19. wr_savedi       dw      0               ;
  20. lx      dw      LXSTART                 ;
  21. ly      dw      LYSTART                 ;
  22. ltrptr  dw      0                       ;
  23. tx_offs dw      0                       ;
  24. letdat  dw      4 dup(2070h)            ;
  25. letdat_end dw   2070h                   ;
  26. letadr  dw      4 dup(0)                ;
  27. letadr_end dw   0                       ;
  28.         ; ------------------------------;
  29.         ; Internal Pause/Clear counters ;
  30. PS_WAIT         =       64              ;
  31. PAUSE_SCROFFS   equ     12802           ;
  32. pausecount      dw      0               ;
  33. pauseflag       db      0               ;
  34.         ;-------------------------------;
  35.         ; One-shot init macro           ;
  36. @writer_init macro                      ;
  37.         push ds                         ;
  38.         mov ax,seg wr_font_seg          ;
  39.         mov ds,ax                       ;
  40.         mov ax,seg scrfont              ;
  41.         mov [wr_font_seg],ax            ;
  42.         mov ax,offset scrfont           ;
  43.         mov [wr_font_off],ax            ;
  44.         pop ds                          ;
  45. endm @writer_init                       ;
  46.         ;-------------------------------;
  47.         ; Do a char                     ;
  48. do_char proc                            ;
  49.         push ds                         ;
  50.         mov dl,bh                       ;
  51.         push dx                         ;
  52.         cmp dl,'a'                      ;
  53.         jl dc_00                        ;
  54.         cmp dl,'z'                      ;
  55.         jg dc_00                        ;
  56.         sub dl,20h                      ;
  57. dc_00:  cmp dl,32                       ;
  58.         jl dc_gotta_go                  ;
  59.         cmp dl,'Z'                      ;
  60.         jle dc_cont                     ;
  61. dc_gotta_go:                            ;
  62.         pop ax                          ;
  63.         xor dx,dx                       ;
  64.         jmp short dc_exit               ;
  65. dc_cont:                                ;
  66.         xor ax,ax                       ;
  67.         mov al,dl                       ;
  68.         sub al,20h                      ;
  69.         mov cx,FONTCHARSIZE             ;
  70.         imul cx                         ;
  71.         add ax,cs:[wr_font_off]         ;
  72.         mov si,ax                       ;
  73.         pop dx                          ;
  74.         push ds                         ;
  75.         mov ax,cs:[datseg]              ;
  76.         mov ds,ax                       ;
  77.         mov ah,bl                       ;
  78.         mov cx,8                        ;
  79. dc00:   push di                         ;
  80.         push cx                         ;
  81.         mov bx,word ptr cs:[si]         ;
  82.         mov dx,word ptr cs:[si+2]       ;
  83.         add si,2                        ;
  84.         mov bp,8000h                    ;
  85.         mov cx,FONT_HEIGHT              ;
  86. dc01:   test bx,bp                      ;
  87.         jz dc02                         ;
  88.         mov al,ah                       ;
  89.         test dx,bp                      ;
  90.         jz dc03                         ;
  91.         inc al                          ;
  92. dc03:   mov ds:[di],al                  ;
  93.         mov es:[di],al                  ;
  94. dc02:   add di,320                      ;
  95.         shr bp,1                        ;
  96.         loop dc01                       ;
  97.         pop cx                          ;
  98.         pop di                          ;
  99.         inc di                          ;
  100.         loop dc00                       ;
  101.         ;-------------------------------;
  102.         pop ds                          ;
  103. dc_exit:                                ;
  104.         pop ds                          ;
  105.         ret                             ;
  106. do_char endp                            ;
  107.         ;-------------------------------;
  108.         ; Screen pausing                ;
  109.         ; Begin pause cycle.            ;
  110. start_pause:                            ;
  111.         mov cs:[pauseflag],1            ;
  112.         mov cs:[pausecount],0           ;
  113.         ret                             ;
  114.         ;-------------------------------;
  115.         ; Do the pause.                 ;
  116. pause_wrds:                             ;
  117.         pusha                           ;
  118.         push ds                         ;
  119.         mov ax,[datseg]                 ;
  120.         mov ds,ax                       ;
  121.         inc cs:[pausecount]             ;
  122.         mov ax,cs:[pausecount]          ;
  123.         cmp ax,PS_WAIT                  ;
  124.         jl pause_exit                   ;
  125.         cmp ax,94+PS_WAIT               ;
  126.         jge end_pause                   ;
  127.         sub ax,56                       ;
  128.         mov bx,ax                       ;
  129.         mov cx,ax                       ;
  130.         sal cx,8                        ;
  131.         sal bx,6                        ;
  132.         add bx,cx                       ;
  133.         add ax,3                        ;
  134.         and ax,7                        ;
  135.         sal ax,3                        ;
  136.         mov dx,ax                       ;
  137.         mov di,bx                       ;
  138.         add di,PAUSE_SCROFFS            ;
  139.         mov cx,6                        ;
  140. pl_a1:  push cx                         ;
  141.         push di                         ;
  142.         mov cx,316                      ;
  143.         mov si,01                       ;
  144. pauseloop:                              ;
  145.         inc si                          ;
  146.         and si,07                       ;
  147.         mov al,byte ptr ds:[di]         ;
  148.         cmp al,66                       ;
  149.         jl pl_03                        ;
  150.         cmp al,70                       ;
  151.         je pl_01                        ;
  152.         inc al                          ;
  153.         jmp short pl_02                 ;
  154. pl_01:  mov ax,si                       ;
  155.         add ax,dx                       ;
  156.         add ax,1                        ;
  157. pl_02:  mov byte ptr es:[di],al         ;
  158.         mov byte ptr ds:[di],al         ;
  159. pl_03:  inc di                          ;
  160.         loop pauseloop                  ;
  161.         pop di                          ;
  162.         add di,320                      ;
  163.         add dx,8                        ;
  164.         and dx,56                       ;
  165.         pop cx                          ;
  166.         loop pl_a1                      ;
  167.         jmp short pause_exit            ;
  168. end_pause:                              ;
  169.         mov cs:[pauseflag],0            ;
  170. pause_exit:                             ;
  171.         pop ds                          ;
  172.         popa                            ;
  173.         ret                             ;
  174.         ;-------------------------------;
  175.         ; Parse the next character.     ;
  176. do_next_char proc                       ;
  177.         push ds                         ;
  178.         push es                         ;
  179.         mov ax,cs                       ;
  180.         mov ds,ax                       ;
  181.         mov es,ax                       ;
  182. dnc_s:  inc cs:[tx_offs]                ;
  183.         mov bx,cs:[tx_offs]             ;
  184.         mov al,byte ptr cs:wrds[bx]     ;
  185.         cmp al,0                        ;
  186.         je dnc_04                       ;
  187.         cmp al,13                       ;
  188.         je dnc_03                       ;
  189.         cmp al,'~'                      ;
  190.         je dnc_02                       ;
  191.         cmp al,'|'      ; clear screen  ;
  192.         je dnc_01                       ;
  193.         ;-------------------------------;
  194.         ; Regular letter.               ;
  195.         push ax                         ;
  196.         mov si,offset letdat            ;
  197.         mov di,si                       ;
  198.         add si,2                        ;
  199.         mov cx,4                        ;
  200. dnc_00: mov ax,word ptr cs:[si]         ;
  201.         dec al                          ;
  202.         mov word ptr cs:[di],ax         ;
  203.         add si,2                        ;
  204.         add di,2                        ;
  205.         loop dnc_00                     ;
  206.         mov si,offset letadr            ;
  207.         mov di,si                       ;
  208.         add si,2                        ;
  209.         mov cx,4                        ;
  210.         rep movsw                       ;
  211.         pop ax                          ;
  212.         mov bx,cs:[ly]                  ;
  213.         mov dx,bx                       ;
  214.         sal bx,6                        ;
  215.         sal dx,8                        ;
  216.         add dx,bx                       ;
  217.         add dx,cs:[lx]                  ;
  218.         mov cs:[letadr_end],dx          ;
  219.         mov ah,al                       ;
  220.         mov al,70                       ;
  221.         mov cs:[letdat_end],ax          ;
  222.         add cs:[lx],LXMOVE              ;
  223.         jmp short dnc_09                ;
  224.         ;-------------------------------;
  225.         ; Clear screen.                 ;
  226. dnc_01: xor ax,ax                       ;
  227.         mov cx,10                       ;
  228.         mov di,offset letdat            ;
  229.         rep stosw                       ;
  230.         call start_pause                ;
  231.         mov cs:[lx],LXSTART             ;
  232.         mov cs:[ly],LYSTART             ;
  233.         jmp short dnc_09                ;
  234.         ;-------------------------------;
  235.         ; Skip letter, but put a space. ;
  236. dnc_02: add cs:[lx],LXMOVE              ;
  237.         jmp dnc_s                       ;
  238.         ;-------------------------------;
  239.         ; New line, and new offset.     ;
  240. dnc_03: add cs:[ly],LYMOVE              ;
  241.         inc cs:[tx_offs]                ;
  242.         mov bx,word ptr cs:[tx_offs]    ;
  243.         mov al,byte ptr cs:wrds[bx]     ;
  244.         movsx ax,al                     ;
  245.         mov cs:[lx],ax                  ;
  246.         jmp dnc_s                       ;
  247. dnc_04: mov cs:[tx_offs],0              ;
  248.         mov cs:[lx],LXSTART             ;
  249.         mov cs:[ly],LYSTART             ;
  250. dnc_09: pop es                          ;
  251.         pop ds                          ;
  252.         ret                             ;
  253. do_next_char endp                       ;
  254.         ;-------------------------------;
  255.         ; Update the writer. Does the   ;
  256.         ; actual legwork.               ;
  257. do_words proc                           ;
  258.         add cs:[ltrptr],2               ;
  259.         cmp cs:[ltrptr],10              ;
  260.         jne dw01                        ;
  261.         mov cs:[ltrptr],0               ;
  262.         call do_next_char               ;
  263. dw01:   mov bx,cs:[ltrptr]              ;
  264.         mov ax,word ptr cs:letdat[bx]   ;
  265.         mov di,word ptr cs:letadr[bx]   ;
  266.         mov bx,ax                       ;
  267.         call do_char                    ;
  268.         ret                             ;
  269. do_words endp                           ;
  270.         ;-------------------------------;
  271.         ; Da Words.                     ;
  272.         ;                               ;
  273.         ; Text by Syntax Error.         ;
  274.         ;---------------------------------------;
  275.         ;                                       ;
  276.         ; '~' means move cursor, but dont       ;
  277.         ;       plot. Aligns text correctly.    ;
  278.         ;                                       ;
  279.         ; 13,?? means next line, offset next    ;
  280.         ;       line by ?? bytes. -1 is standard;
  281.         ;       3 is to center.                 ;
  282.         ;                                       ;
  283.         ; '|' means to clear the screen.        ;
  284.         ;                                       ;
  285.         ; Zero restarts the text.               ;
  286.         ;---------------------------------------;
  287. wrds    db      13,-1,13,-1
  288.         db      '~~~~~~~~~~~~~~~~THE POWERGRID'                 ,13,-1
  289.         db      '         PHONE NUMBER: 1-813-278-3680'         ,13,3
  290.         db      ' STAFF: GRIDRUNNER, SYNTAX ERROR, AND COWBOY'  ,13,-1
  291.         db      '~~~VISION/2 0.85B REGISTERED SITE.. NO NUP'    ,13,3
  292.         db      '~~~~~~~USR 16.8 DUAL AND A GIG STORAGE       |',13,-1
  293.         db      '      THE ULTIMATE DEMO/ART EXPERIENCE!'       ,13,-1
  294.         db      '    WE SUPPORT THE FOLLOWING DEMO GROUPS:'     ,13,-1
  295.         db      13,-1
  296.         db      ' AVALANCHE WORLD HQ AND DIST APPLICATION HOME' ,13,-1
  297.         db      '~LEINAD FAN CLUB HOME AND WORSHIPPING GROUNDS     |',13,-1
  298.         db      '   US HEADQUARTERS FOR THE FOLLOWING GROUPS '  ,13,-1
  299.         db      '~~FUTURE CREW,DUST,SHADOW FACTION,TEI,IGUANA'  ,13,-1
  300.         db      '~~PSYCHIC MONKS,PENTAGON,DARKZONE,GOLLUM AND'  ,13,3
  301.         db      '~~~~~~~~~~~~~~~~PHANTOMDESIGN'                 ,13,3
  302.         db      '~~~~~~~~~~~~~~      ~~~~~~~~~~~~~~~~~~~~~~~~|' ,13,3
  303.         db      '   WE ALSO SERVE AS DISTRIBTION SITES FOR:'    ,13,3
  304.         db      'THE SILENTS PC * SURPRISE! PRODUCTIONS * VLA'  ,13,3
  305.         db      'ELECTROMOTIVE FORCE * TWILIGHT ZONE * ADMIRE'  ,13,3
  306.         db      '~~~IGUANA * EXTREME * AARDVARK * XOGRAPHY'     ,13,-1
  307.         db      '~~~~~~~~~RENAISSANCE * MENTAL DESIGN     |'    ,13,-1
  308.         db      '    WE SUPPORT THE FOLLOWING ANSI GROUPS:'     ,13,-1
  309.         db      13,3
  310.         db      '  ~~~~~~~~~~ICE, UNION, SHIVER                 ',13,3
  311.         db      '     |',13,-1
  312.         db      '           MAGAZINE DISTRIBUTIONS:'            ,13,-1
  313.         db      13,-1
  314.         db      '~~~~~!INTENSITY MAGAZINE US HEADQUARTERS '     ,13,-1
  315.         db      '~~PULSE DEMO MAGAZINE DISTRIBUTION / POLLING     |',13,3
  316.         db      '     INFINITY MAGAZINE DISTRIBUTION SITE'      ,13,-1
  317.         db      '~~~~~ADRENALIN MAGAZINE DISTRIBUTION SITE'     ,13,-1
  318.         db      '~~~~~~IRIDIUM MAGAZINE DISTRIBUTION SITE     |',13,-1
  319.         db      '     SPECIAL THANKS TO FRIAR TUCK, PIXEL,'     ,13,3
  320.         db      '~~~~~~~~~~PSI, AND EIGHT BALL FOR'             ,13,-1
  321.         db      '~~~CONTRIBUTING TO THIS NICE LITTLE PACKAGE'   ,13,3
  322.         db      'HI SOUL REBEL, EGGHEAD, AND DEEPLY DISTURBED!' ,13,-1
  323.         db      ' HEY TEMPUS, THIS WHAT YOU WERE LOOKING FOR?     |',0
  324.  
  325.  
  326.